package com.qn.mapper;

import com.qn.dto.CarDTO;
import com.qn.entity.Car;
import com.qn.entity.Person;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(componentModel = "spring")
public interface CarConverter {

    /**
     * car,person -> CarDto
     *
     * @param car    车
     * @param person 人
     * @return {@link CarDTO}
     */
    @Mapping(source = "car.make", target = "manufacturer")
    @Mapping(source = "car.numberOfSeats", target = "seatCount")
    CarDTO carToCarDto(Car car, Person person);
}
